﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using CrazyWorship1.Class_Files.PropertyHandler;
using CrazyWorship1.Properties;

namespace CrazyWorship1
{
    public sealed class DataAttribute : Attribute
    {
        public DataAttribute(string fieldName,Type handler,string defaultValue)
        {
            _fieldName = fieldName;
            _handler = (PropertyHandlerControl)Activator.CreateInstance(handler);
            _handler.SettingDebugInfo = defaultValue;
            
            _handler.DefaultValue = (string)Settings.Default[defaultValue];
        }
        private PropertyHandlerControl _handler;
        public PropertyHandlerControl Handler
        {
            get
            {
                return _handler;
            }

        }
        /// <summary>
        /// The name of the field in the database
        /// </summary>
        public string FieldName
        {
            get
            {
                return _fieldName;
            }
        }
        private string _fieldName = "";
    }

}
